home *** CD-ROM | disk | FTP | other *** search
/ SPACE 2 / SPACE - Library 2 - Volume 1.iso / utility / 100 / gwait.s < prev    next >
Encoding:
Text File  |  1987-01-16  |  3.7 KB  |  136 lines

  1. *Frank -- I couldn't resist this:
  2. *    (Also, my reponse to you saying you're cracked, is to show 
  3. *     that I am even more cracked!)
  4. *
  5. *
  6. * GWAIT.S -- Just wait for a key at the keyboard, dinging the bell
  7. *            occasionally.
  8. *
  9. *
  10. * Didnae ken that you guys were annoyed by that wait message. But
  11. * 7k is too much overhead for me. Here's one in 68000 that rings
  12. * the bell while weighing in at about 250 bytes. You can plug in 
  13. * whatever message you like at "message:", just remember the 0 byte 
  14. * on the end. Then simply assemble and link this with the batch:
  15. *
  16. * as68 -l -u %1.s
  17. * link68 [u,s] %1.68k=%1
  18. * relmod %1.68k %1.prg
  19. * rm %1.68k
  20. * wait.prg
  21. *
  22. *
  23. * Crazier than Frank,
  24. *
  25. *                Greywolf.
  26. *
  27.         .data
  28.  
  29. CR:     .equ    $0A
  30. LF:     .equ    $0D
  31.  
  32. delshort:  .dc.l  0500          * Short delay between the bells in a set
  33. *                                about 1/3 of a sec
  34. *
  35. dellong:   .dc.l  0300          * Long delay between sets of bells
  36. *                                this number times delshort's time for time
  37. *
  38. belcnt:    .dc.l  02            * Number of bells in a row (set) -1
  39.  
  40. message:  .dc.b CR,LF,LF,'Strike any key when ready...',0
  41.  
  42. crlflf:   .dc.b CR,LF,LF,0
  43.  
  44.         .text
  45. start:
  46.         lea     stack,sp
  47.         lea     message,a0
  48.         move.l  a0,-(sp)
  49.         move.w  #09,-(sp)       *bdos prt_str
  50.         trap #1
  51. *
  52.         addq.l  #6,sp
  53. *
  54. waitloop:
  55.         bsr     threebels
  56.         bsr     waitkey
  57.         cmpi.b  #0,d0
  58.         beq     waitloop
  59. *
  60. *
  61. *
  62.         cmpi.b  #03,d0          *did we have a control - C
  63.         beq     out             *Yes? -- return it as an error (in the hope
  64. *                               some future batch program or CLI will be
  65. *                               able to pick it up.
  66.         move.w  #0,d0           * No? -- then return no error.
  67. out:
  68.         move.w  d0,-(sp)        *stuff return code
  69.         lea     crlflf,a0       * print two blank lines
  70.         move.l  a0,-(sp)
  71.         move.w  #09,-(sp)       *bdos prt_str
  72.         trap #1
  73. *
  74.         addq.l  #6,sp
  75. *
  76.         move.w  #$04C,-(sp)     *term prog (RC is already on the stack)
  77. exit:
  78.         trap #1
  79. *
  80. threebels:                      *ring the bell
  81.         move.l  d0,-(sp)
  82.         move.l  belcnt,d0               *number of times
  83. ringloop:
  84.         move.l  d0,-(sp)        *push it (I dont trust bdos)
  85. *
  86.         move.w  #07,-(sp)       *bell
  87.         move.w  #02,-(sp)       *conout
  88.         trap #1
  89.         addq.l  #4,sp
  90.         bsr     shortwait       *short delay
  91.         move.l  (sp)+,d0        *pop count
  92.         dbf     d0,ringloop
  93. *
  94.         move.l  (sp)+,d0
  95.         rts
  96. *
  97. shortwait:                      * Short delay (constantly checking for key)
  98.         move.l  d1,-(sp)
  99.         move.l  delshort,d1
  100. swaitloop:
  101.         move.l  d1,-(sp)        * push the count (I don't trust bdos)
  102.         move.w  #$0ff,-(sp)     *getchar
  103.         move.w  #06,-(sp)       *rawconio
  104.         trap #1
  105.         addq.l  #04,sp
  106.         move.l  (sp)+,d1        * pop the count
  107. *
  108.         cmpi.l  #0,d0           *was there a char?
  109.         dbne    d1,swaitloop
  110. *
  111.         move.l  (sp)+,d1
  112.         rts
  113. *
  114. *
  115. waitkey:                *long wait between bell sets while checking keyboard
  116.  
  117.         move.l  d1,-(sp)
  118.         move.l  dellong,d1
  119. waitkloop:
  120.         bsr     shortwait       *wait a mo, (and  was ther a char)
  121. *
  122.         cmpi.l  #0,d0           *was there a char?
  123.         dbne    d1,waitkloop
  124. *
  125.         move.l  (sp)+,d1
  126.         rts                     *with any got char in d0
  127. *
  128.         .bss
  129.  
  130.         .ds.l   256             * why not? it costs us no disk space!
  131. stack:  .ds.l   1
  132.  
  133.         .end
  134.  
  135.  
  136.